// 事件列表的列定义
export const EVENT_COLUMNS = [
    // 基础元数据组
    {
        title: '基础信息',
        children: [
            {
                title: '事件ID',
                dataIndex: 'event_id',
                width: 120,
                ellipsis: true,
                fixed: 'left',
                key: 'event_id'
            },
            {
                title: '事件名称',
                dataIndex: 'event_name',
                width: 150,
                ellipsis: true,
                key: 'event_name'
            },
            {
                title: '事件类型',
                dataIndex: 'event_type',
                width: 120,
                ellipsis: true,
                key: 'event_type'
            },
            {
                title: '事件规则',
                dataIndex: 'event_rule',
                width: 120,
                ellipsis: true,
                key: 'event_rule'
            },
            {
                title: '事件时间',
                dataIndex: 'event_time',
                width: 160,
                ellipsis: true,
                key: 'event_time'
            },
            {
                title: '危险等级',
                dataIndex: 'severity',
                width: 100,
                ellipsis: true,
                key: 'severity'
            }
        ]
    },

    // 资产信息组
    {
        title: '资产信息',
        children: [
            {
                title: '设备名称',
                dataIndex: 'device_name',
                width: 120,
                ellipsis: true,
                key: 'device_name'
            },
            {
                title: '设备IP',
                dataIndex: 'device_ip',
                width: 120,
                ellipsis: true,
                key: 'device_ip'
            },
            {
                title: '攻击报文',
                dataIndex: 'attack_packets',
                width: 150,
                ellipsis: true,
                key: 'attack_packets'
            },
            {
                title: '目标资产名称',
                dataIndex: 'dst_cmdb_name',
                width: 120,
                ellipsis: true,
                key: 'dst_cmdb_name'
            },
            {
                title: '源资产名称',
                dataIndex: 'src_cmdb_name',
                width: 120,
                ellipsis: true,
                key: 'src_cmdb_name'
            },
            {
                title: '源安全域',
                dataIndex: 'src_security_domains',
                width: 120,
                ellipsis: true,
                key: 'src_security_domains'
            },
            {
                title: '目标安全域',
                dataIndex: 'dst_security_domains',
                width: 120,
                ellipsis: true,
                key: 'dst_security_domains'
            }
        ]
    },

    // 源端点信息组
    {
        title: '源端点信息',
        children: [
            {
                title: '源IP',
                dataIndex: 'src_ip',
                width: 120,
                ellipsis: true,
                key: 'src_ip'
            },
            {
                title: '源端口',
                dataIndex: 'src_port',
                width: 100,
                ellipsis: true,
                key: 'src_port'
            },
            {
                title: '源主机名',
                dataIndex: 'src_hostname',
                width: 120,
                ellipsis: true,
                key: 'src_hostname'
            },
            {
                title: '源MAC',
                dataIndex: 'src_mac',
                width: 130,
                ellipsis: true,
                key: 'src_mac'
            },
            {
                title: '源负责人',
                dataIndex: 'src_leader',
                width: 100,
                ellipsis: true,
                key: 'src_leader'
            },
            {
                title: '源资产类型',
                dataIndex: 'src_type',
                width: 100,
                ellipsis: true,
                key: 'src_type'
            }
        ]
    },

    // 目标端点信息组
    {
        title: '目标端点信息',
        children: [
            {
                title: '目标IP',
                dataIndex: 'dst_ip',
                width: 120,
                ellipsis: true,
                key: 'dst_ip'
            },
            {
                title: '目标端口',
                dataIndex: 'dst_port',
                width: 100,
                ellipsis: true,
                key: 'dst_port'
            },
            {
                title: '目标主机名',
                dataIndex: 'dst_hostname',
                width: 120,
                ellipsis: true,
                key: 'dst_hostname'
            },
            {
                title: '目标负责人',
                dataIndex: 'dst_leader',
                width: 100,
                ellipsis: true,
                key: 'dst_leader'
            },
            {
                title: '目标资产类型',
                dataIndex: 'dst_type',
                width: 100,
                ellipsis: true,
                key: 'dst_type'
            }
        ]
    },

    // 用户信息组
    {
        title: '用户信息',
        children: [
            {
                title: '用户名',
                dataIndex: 'user_name',
                width: 100,
                ellipsis: true,
                key: 'user_name'
            }
        ]
    },

    // 网络协议信息组
    {
        title: '网络协议信息',
        children: [
            {
                title: 'HTTP方法',
                dataIndex: 'req_method',
                width: 100,
                ellipsis: true,
                key: 'req_method'
            },
            {
                title: '请求URL',
                dataIndex: 'req_url',
                width: 200,
                ellipsis: true,
                key: 'req_url'
            },
            {
                title: '状态码',
                dataIndex: 'req_status',
                width: 100,
                ellipsis: true,
                key: 'req_status'
            },
            {
                title: '主机',
                dataIndex: 'req_host',
                width: 120,
                ellipsis: true,
                key: 'req_host'
            }
        ]
    },

    // 威胁信息组
    {
        title: '威胁信息',
        children: [
            {
                title: '威胁分类',
                dataIndex: 'threat_category',
                width: 120,
                ellipsis: true,
                key: 'threat_category'
            },
            {
                title: '攻击类型',
                dataIndex: 'attack_type',
                width: 120,
                ellipsis: true,
                key: 'attack_type'
            },
            {
                title: '攻击结果',
                dataIndex: 'attack_result',
                width: 100,
                ellipsis: true,
                key: 'attack_result'
            },
            {
                title: '攻击阶段',
                dataIndex: 'super_type',
                width: 100,
                ellipsis: true,
                key: 'super_type'
            },
            {
                title: '置信度',
                dataIndex: 'confidence',
                width: 100,
                ellipsis: true,
                key: 'confidence'
            }
        ]
    },

    // 地理位置组
    {
        title: '地理位置',
        children: [
            {
                title: '源地理位置',
                children: [
                    {
                        title: '国家',
                        dataIndex: 'srcgeocountry',
                        width: 100,
                        ellipsis: true,
                        key: 'srcgeocountry'
                    },
                    {
                        title: '城市',
                        dataIndex: 'srcgeocity',
                        width: 100,
                        ellipsis: true,
                        key: 'srcgeocity'
                    }
                ]
            },
            {
                title: '目标地理位置',
                children: [
                    {
                        title: '国家',
                        dataIndex: 'dstgeocountry',
                        width: 100,
                        ellipsis: true,
                        key: 'dstgeocountry'
                    },
                    {
                        title: '城市',
                        dataIndex: 'dstgeocity',
                        width: 100,
                        ellipsis: true,
                        key: 'dstgeocity'
                    }
                ]
            }
        ]
    },

    // 处置信息组
    {
        title: '处置信息',
        children: [
            {
                title: '处置结果',
                dataIndex: 'action',
                width: 100,
                ellipsis: true,
                key: 'action'
            },
            {
                title: '设备处置',
                dataIndex: 'blocked',
                width: 100,
                ellipsis: true,
                key: 'blocked'
            }
        ]
    },

    // 操作列
    {
        title: '操作',
        dataIndex: 'operation',
        fixed: 'right',
        width: 120,
        key: 'operation'
    }
];

// 列的默认渲染配置
export const COLUMN_RENDER_CONFIG = {
    // 等级相关
    severity: {
        type: 'tag',
        colorMap: {
            '1': 'blue',    // 信息
            '2': 'cyan',    // 低危
            '3': 'orange',  // 中危
            '4': 'red',     // 高危
            '5': 'purple'   // 严重
        }
    },
    
    // IP地址相关
    src_ip: { type: 'tag', color: 'geekblue' },
    dst_ip: { type: 'tag', color: 'geekblue' },
    device_ip: { type: 'tag', color: 'geekblue' },
    
    // 端口相关
    src_port: { type: 'tag', color: 'cyan' },
    dst_port: { type: 'tag', color: 'cyan' },
    
    // 时间相关
    event_time: { type: 'datetime' },
    timestamp: { type: 'datetime' },
    
    // 状态相关
    attack_result: {
        type: 'tag',
        colorMap: {
            '成功': 'red',
            '失败': 'green'
        }
    },

    // HTTP状态码
    req_status: {
        type: 'tag',
        colorMap: {
            '200': 'green',
            '404': 'orange',
            '500': 'red'
        }
    },

    // 资产类型
    src_type: {
        type: 'tag',
        colorMap: {
            '1': 'blue',   // 内部资产
            '0': 'orange'  // 外部资产
        }
    },
    dst_type: {
        type: 'tag',
        colorMap: {
            '1': 'blue',   // 内部资产
            '0': 'orange'  // 外部资产
        }
    },

    // HTTP方法
    req_method: {
        type: 'tag',
        colorMap: {
            'GET': 'green',
            'POST': 'blue',
            'PUT': 'orange',
            'DELETE': 'red'
        }
    },

    // 处置结果
    blocked: {
        type: 'tag',
        colorMap: {
            '已阻断': 'red',
            '已放行': 'green',
            '监控': 'orange'
        }
    }
}; 